<%@ page
	language="java"
	contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
%>
<%@ page import="java.util.*" %>
<%@ page import="com.zen.facebook.FaceBookAPI" %>
<%@ page import="com.zen.common.Constants" %>
<%@ page import="net.sf.json.JSONObject" %>
<%@ page import="com.google.code.facebookapi.*" %>
<%

	    // Create the client instance
	    System.out.println("=========1============");
		FacebookJsonRestClient client = new FacebookJsonRestClient("fea7c3d67e1338cdf85abc9fec753383", "ee9078a8755e6925e5c9fbbad51af177");
		System.out.println("=========2============");
	    String token = client.auth_createToken(); // is this a desktop app
	    System.out.println(client.getServerUrl());
	    System.out.println("token : " + token);
	    
	    Attachment acm = new Attachment();
	
	
	FaceBookAPI fba = new FaceBookAPI(Constants.FACEBOOK_API_KEY, "155467971175699|2.5CHebAZBs2Ae9ydDf6EMfA__.3600.1298527200-100002066827866|Jued6TKloJxWlOFPpfWXrHSJglY");
	JSONObject gui = fba.getMyInfo();
	System.out.println("gui : " + gui.toString());
System.out.println("=====================");
Map<String, String> data = new HashMap<String, String>();   
data.put("message", "Test message, My blog link");   
data.put("link", "http://blog.daum.net/sonaeho/?t__nil_login=myblog");   
data.put("name", "aeho blog");   
data.put("picture", "http://cyimg33.cyworld.com/common/file_down.asp?redirect=%2F330027%2F2011%2F1%2F21%2F59%2F20110121163646%5F23857711%2Ejpg");    
  
JSONObject result = fba.sendPost(data);   
System.out.println("========result=============" + result.toString());
String post_id = result.getString("id");   
//result객체로 결과가 리턴됩니다. (성공하였을 경우 등록된 메시지 id가 돌아옵니다.)   

System.out.println("========post_id=============" + post_id);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>FaceBook API Test</title>
</head>
<body>
<%=post_id %>
</body>
</html>